package com.chinasofti.map;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Demo04 {
    public static void main(String[] args) {
        Map<String,String> map = new HashMap<>();

        //put(K key , V value)
        map.put("K1","V1");
        map.put("K2","V2");
        map.put("K3","V3");
        map.put("K4","V4");
        map.put("K5","V5");

        //method1(map);

        Set<Map.Entry<String,String>> entrySet = map.entrySet();
        for (Map.Entry<String,String> me:entrySet){
            String key = me.getKey();
            String value = me.getValue();
            System.out.println(key +"," + value);
        }

    }

    private static void method1(Map<String, String> map) {
        Set<String> keySet = map.keySet();
        for (String k : keySet){
            String v = map.get(k);
            System.out.println(k + " ^^ " + v);
        }
    }
}
